// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Helper annotations for asynchronous computation.
 * Used for example in IDEA debugger for async stacktraces feature.
 *
 * @author egor
 */
public interface Async {

    /**
     * Indicates that the marked method schedules async computation.
     * Scheduled object is either {@code this}, or the annotated parameter value.
     */
    @Retention(RetentionPolicy.CLASS)
    @Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.PARAMETER})
    @interface Schedule {
    }

    /**
     * Indicates that the marked method executes async computation.
     * Executed object is either {@code this}, or the annotated parameter value.
     * This object needs to match with the one annotated with {@link Schedule}
     */
    @Retention(RetentionPolicy.CLASS)
    @Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.PARAMETER})
    @interface Execute {
    }
}
